package cn.demo.controller;

import cn.demo.domain.Demo;
import cn.demo.service.IDemoService;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;


@Controller
@RequestMapping("/demo")
public class TestController {

    private Logger LOG = LoggerFactory.getLogger(TestController.class);

    @Autowired
    private IDemoService<Demo, ?> demoService;


    @ResponseBody
    @RequestMapping(value = "demo", method = RequestMethod.GET)
    public Demo autherGet() {
        Map<String, Object> condition = Maps.newHashMap();
        Demo demo = new Demo();
        demo.setCreateDate(1111111L);
        demoService.add(demo);
        return demoService.findOne(condition);

    }


    public static void main(String[] args) {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(11111);
            }
        });

        thread.run();
        ;
        System.out.println(222);
    }

}
